//建立数据库连接代码
//引入mongoose模块
let mongoose = require('mongoose');
//连接数据库
//数据库的URL
let dbURL = 'mongodb://127.0.0.1:27017/student';
mongoose.connect(dbURL, {
    useNewUrlParser: true,
    useUnifiedTopology: true
});
//设置连接成功时要执行的回调函数
mongoose.connection.on('connected', function() {
    console.log('数据库连接成功');
})